package com.chenjt.jvm.first.five_heap;

import java.util.ArrayList;
import java.util.List;

/**
 * 注释：
 * 测试MinorGC、majorGC和FullGC
 *
 * -Xms9m -Xmx9m -XX:+PrintGCDetails
 *
 * @author chenjt
 * @date 2025/6/9 11:16
 */
public class GCTest {

    public static void main(String[] args) {
        int i = 0;

        try {
            List<String> list = new ArrayList<>();
            String a = "chenjt";
            while(true){
                list.add(a);
                a = a + a;
                i++;
            }
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("遍历次数为：" + i);
        }

    }

}
